package com.aizuda.boot.modules.common.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 银行绑定类型枚举
 */
@Getter
@AllArgsConstructor
public enum BindingTypeEnum {
    COUNTERPARTY("COUNTERPARTY", "交易方"),
    LEGAL_ENTITY("LEGAL_ENTITY", "法人");

    private final String code;
    private final String desc;

    /**
     * 根据code获取描述
     */
    public static String getDescByCode(String code) {
        if (code == null) {
            return null;
        }
        for (BindingTypeEnum typeEnum : values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum.getDesc();
            }
        }
        return code;
    }

    /**
     * 根据描述获取code
     */
    public static String getCodeByDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (BindingTypeEnum typeEnum : values()) {
            if (typeEnum.getDesc().equals(desc)) {
                return typeEnum.getCode();
            }
        }
        return desc;
    }
} 